<template>
  <view class="container">
    <nav-bar title="公寓资料" :showBack="true"></nav-bar>
    
    <view class="content">
      <!-- 公寓名称 -->
      <view class="form-item">
        <text class="label">公寓名称</text>
        <input type="text" v-model="apartmentInfo.name" placeholder="请输入公寓名称" />
      </view>
      
      <!-- 公寓地址 -->
      <view class="form-item">
        <text class="label">公寓地址</text>
        <input type="text" v-model="apartmentInfo.address" placeholder="请输入公寓地址" />
      </view>
      
      <!-- 联系电话 -->
      <view class="form-item">
        <text class="label">联系电话</text>
        <input type="text" v-model="apartmentInfo.phone" placeholder="请输入联系电话" />
      </view>
      
      <!-- 营业时间 -->
      <view class="form-item">
        <text class="label">营业时间</text>
        <input type="text" v-model="apartmentInfo.businessHours" placeholder="请输入营业时间" />
      </view>
      
      <!-- 保存按钮 -->
      <view class="save-btn" @click="handleSave">
        <text>保存</text>
      </view>
    </view>
  </view>
</template>

<script>
import NavBar from '@/components/nav-bar/index.vue'

export default {
    components: {
        NavBar
    },
  data() {
    return {
      apartmentInfo: {
        name: '',
        address: '',
        phone: '',
        businessHours: ''
      }
    }
  },
  methods: {
    handleSave() {
      // TODO: 保存公寓资料
      uni.showToast({
        title: '保存成功',
        icon: 'success'
      })
      setTimeout(() => {
        uni.navigateBack()
      }, 1500)
    }
  }
}
</script>

<style lang="scss" scoped>
.container {
  min-height: 100vh;
  background-color: #f5f5f5;
}

.content {
  padding: 20rpx;
}

.form-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30rpx 20rpx;
  background-color: #fff;
  margin-bottom: 2rpx;
  
  .label {
    font-size: 28rpx;
    color: #333;
  }
  
  input {
    text-align: right;
    font-size: 28rpx;
    width: 400rpx;
  }
}

.save-btn {
  margin-top: 40rpx;
  background-color: #1890ff;
  text-align: center;
  padding: 30rpx 0;
  border-radius: 8rpx;
  
  text {
    font-size: 28rpx;
    color: #fff;
  }
}
</style>